As a mask inspection apparatus which detects a defect existing on a photomask, the mask inspection apparatus which captures a reflected image or a transmitted image of the photomask and compares the captured image with a reference image so as to detect the defects is used in practice. In order to accurately detect the defect in the mask inspection apparatus, it is important to precisely control a focal point of the objective lens which focuses the reflected light or the transmitted light emitted from the photomask. For instance, when the focal point of the objective lens deviates from the surface of the photomask, the captured image of the photomask becomes blurred, and therefore the problem arises that a number of false defects are detected frequently. Furthermore, the mask patterns formed on the photomask become finer and the line width of the pattern is designed so as to be around 200 nm. Therefore, it is strongly demanded that the focus control of the objective lens is performed more accurately in accordance with the refinement of the patterns.
A substrate of the photomask has inevitable deflection or flexure. Although a combination of an air slider and a linear motor is usually used as a driving device for driving a stage for supporting the mask, a minute displacement along the Z axis occurs in the stage during its movement. Accordingly, in the mask inspection apparatus, an autofocus system for controlling a position of the focal point of the objective lens along an optical axis is used in order to correspond to the deflection of the photomask and the undesirable movement of the stage.
As a conventional autofocus system, it is well-known that the distance between the focal point of the objective lens and the surface of the photomask is detected as a focus error signal and that the position of the objective lens along its axis is feedback controlled using the detected focus error signal. In this known autofocus system, a focus detector for detecting the deviation between the focal point of the objective lens and the surface of the photomask by for example an astigmatic method is used, and the focus error signal is produced using the output signal form the focus detector. During the scanning of the photomask, feedback control by use of the focus error signal is performed so that the deviation between the focal point of the objective lens and the surface of the photomask becomes zero.
As another substrate inspection apparatus, a reticle inspection apparatus in which a height distribution of an upper surface of the reticle is measured to form a three dimensional topographical map of the whole surface of the reticle prior to the inspection and the position of the objective lens is controlled using the three dimensional topographical map has been known (for example, see PLT 1). In this known inspection apparatus, after the three dimensional topographical map of the whole surface of the reticle is produced, the inspection of the reticle is performed, and the position of the objective along its optical axis is controlled using the topographical map during the inspection.    PLT1: U.S. Pat. No. 7,835,015